package gui.Error;

public class TextToInt {

	public static int getValueOf(String i) throws TextToIntException{
		if(i.length()==0)
			throw new TextToIntException("Champs vide!");
		int res=0;
		for(int j=0;j<i.length();j++){
			if((i.charAt(j)>='0')&&(i.charAt(j)<='9'))
				res=res*10+i.charAt(j)-'0';
			else throw new TextToIntException(i+" : n'est pas un entier positif");
		}
		return res;
	}
	
}
